import axios from './axios'

let instance = axios()

export default {
    // 注册
    userRegister(params) {
        return instance.post('/dlapi/user/register', params);
    },
    // 登录
    userLogin(params) {
        return instance.post('/dlapi/user/login', params);
    },
    // 型号批次总览
    overviewList(params) {
        return instance.get('/dlapi/device/findList', { params });
    },
    // 查询设备编号
    getEquipmentSerial(params) {
        return instance.get('/dlapi/device/selectDeviceNoList', { params });
    },
    // 保存设备编号
    saveEquipmentSerial(params) {
        return instance.post('/dlapi/device/updateDeviceNo', params);
    },
    // 查询操作终端
    getTerminal(params) {
        return instance.get('/dlapi/device_send_group/selectOperatorClient', { params });
    },
    // 型号批次新增
    modelSave(params) {
        return instance.post('/dlapi/device/insert', params);
    },
    // 型号批次修改
    modelEdit(params) {
        return instance.post('/dlapi/device/update', params);
    },
    // 型号批次删除
    modelDel(params) {
        return instance.get('/dlapi/device/deleteById', { params });
    },
    // 试验项目设置
    testProjectList(params) {
        return instance.get('/dlapi/device_project_config/selectList', { params });
    },
    // 试验项目设置保存
    testProjectSave(params) {
        return instance.post('/dlapi/device_project_config/save', params);
    },
    // 试验项目结果
    testProjectResult(params) {
        return instance.get('/dlapi/device_project_record/selectList', { params });
    },
    // 试验项目结果-文档
    testDocResult(params) {
        return instance.get('/dlapi/device_doc_record/selectList', { params });
    },
    // 文档检查项设置
    documentItemList(params) {
        return instance.get('/dlapi/device_doc_config/selectList', { params });
    },
    // 文档检查项设置保存
    documentItemSave(params) {
        return instance.post('/dlapi/device_doc_config/save', params);
    },
    // 新增任务下发分组
    addIssuedGroup(params) {
        return instance.post('/dlapi/device_send_group/insert', params);
    },
    // 编辑任务下发分组
    editIssuedGroup(params) {
        return instance.post('/dlapi/device_send_group/update', params);
    },
    // 删除任务下发分组
    delIssuedGroup(params) {
        return instance.get('/dlapi/device_send_group/deleteById', { params });
    },
    // 任务下发
    issuedGroup(params) {
        return instance.get('/dlapi/device_send_group/sendGroup', { params });
    },
    // 任务下发分组查询
    issuedGroupList(params) {
        return instance.get('/dlapi/device_send_group/selectList', { params });
    },
    // 删除任务
    taskDel(params) {
        return instance.post('/dlapi/device_send_group/deleteSendDataById', params);
    },
    // 文件导入-试验项目配置
    uploadFile(params, id) {
        let config = {
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        }
        return instance.post('/dlapi/device_project_config/importExcel?deviceId=' + id, params, config);
    },
    // 文件导入-文档检查项目配置
    uploadDocFile(params, id) {
        let config = {
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        }
        return instance.post('/dlapi/device_doc_config/importExcel?deviceId=' + id, params, config);
    },
    // 文件导出
    exportFile(params) {
        return instance({
            method: 'get',
            url: `/dlapi/device_project_config/exportExcel`,
            params: params,
            responseType: 'blob'
        })
    },
    // 文件导出-文档检查项目配置
    exportDocFile(params) {
        return instance({
            method: 'get',
            url: `/dlapi/device_doc_config/exportExcel`,
            params: params,
            responseType: 'blob'
        })
    },
    // 下载报告
    downloadReport(params) {
        return instance({
            method: 'get',
            url: `/dlapi/device_project_record/downloadReport`,
            params: params,
            responseType: 'blob'
        })
    },
    // 数据导出
    exportData(params) {
        return instance({
            method: 'get',
            url: `/dlapi/device_project_record/exportExcel`,
            params: params,
            responseType: 'blob'
        })
    },
    // 压缩包导出
    exportPackage(params) {
        return instance({
            method: 'get',
            url: `/dlapi/device/reportZip`,
            params: params,
            responseType: 'blob'
        })
    },
    // 查看附件
    downloadFile(params) {
        return instance({
            method: 'get',
            url: `/dlapi/attach/download`,
            params: params,
            responseType: 'blob'
        })
    }
}